// import Nevow.Athena
// import Divmod.Runtime

Meercat.Multiprocessing.List = Nevow.Athena.Widget.subclass('Meercat.Multiprocessing.List');

Meercat.Multiprocessing.List.methods(
function loaded(self) {
    self.refresh();
},
function refresh(self) {
    d = self.callRemote('getActiveList');
    d.addCallback(function (result) {
        var ul = jQuery('#' + escapeId(self.node.id) + ' > ul.MultiprocessingList');
        ul.empty();
        
        for (i = 0; i < result.length; i++) {
            var active = '';
            if (result[i].alive) active = 'alive';
            else active = 'dead';
            
            ul.append('<li class="' + active + '">' + result[i].name + ' (' + result[i].pid + ')</li>');
        }
    });
    
    return d;
});
